<template>
  <div v-if="loading" class="global-loading">
    <a-spin size="large">
      <a-icon slot="indicator" type="loading" style="font-size: 24px" spin />
      <div class="loading-text">{{ text }}</div>
    </a-spin>
  </div>
</template>

<script>
export default {
  name: 'GlobalLoading',
  props: {
    loading: {
      type: Boolean,
      default: false
    },
    text: {
      type: String,
      default: '加载中...'
    }
  }
}
</script>

<style lang="scss" scoped>
.global-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;

  .loading-text {
    margin-top: 8px;
    color: #1890ff;
  }
}
</style>
